<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * 客户表
 */
class Customer_mdl extends MY_Model {

    //客户类型
    public $ctype = array(
        '1' => '未打电话',
        '2' => '已发资料',
        '3' => '确认已看资料但未约上门',
        '4' => '等待上门',
        '5' => '已成交'
    );

    //客户级别
    public $cranks = array(
        '1' => '普通客户',
        '2' => '劣质客户',
        '3' => '优质客户',
        '4' => '重点客户',
        '5' => '潜在客户',
        '6' => '钻石客户',
        '7' => 'VIP客户'
    );


    public function __construct() {
        parent::__construct();
        $this->table = 'customer';
    }

    /**
     * 统计所有非公海用户
     */
    public function count_cust(){

        if($_SESSION['user']['group'] != 1){
            $this->db->where('user_id',$_SESSION['user']['id']);
        }
        $this->db->where('user_id !=','-1');
        return $this->get_count();
    }

    /**
     * 统计公海人数
     */
    public function count_common(){
        $this->db->where('user_id','-1');
        return $this->get_count();
    }

}

/* End of file customer_mdl.php */
/* Location: ./application/models/customer_mdl.php */